package com.sfc.spiderweb.entity.po.adb;

import com.sfc.spiderweb.eunm.ReshipType;
import com.sfc.spiderweb.util.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.util.StringUtils;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Data
@ApiModel
public class PlatformOrdersWriteExcel implements Serializable {

    @ApiModelProperty("lazada账号")
    private String siteId;

    @ApiModelProperty("币种")
    private String currency;

    @ApiModelProperty("istore订单号")
    private String ordersCode;

    @ApiModelProperty("istoreReship订单号")
    private String reshipOrdersCode;

    @ApiModelProperty("istore订单总金额(原币)")
    private BigDecimal grandTotal;

    @ApiModelProperty("istore扣费日期")
    private Date chargebackTime;

    @ApiModelProperty("istore订单状态")
    private String ordersStatus;

    @ApiModelProperty("平台账单日期")
    private String statement;

    @ApiModelProperty("平台订单号")
    private String ebayCode;

    @ApiModelProperty("订单收入金额")
    private BigDecimal amount;

    @ApiModelProperty("差异")
    private BigDecimal deff;

    @ApiModelProperty("折扣")
    private BigDecimal ordersDiscount;

    @ApiModelProperty("订单类型:0-主单;1-分单;2-重寄单;3-合并单")
    private Integer reshipType;

    public static List<String> convert(PlatformOrdersWriteExcel recode) {
        List<String> list = new ArrayList<>();
        list.add(recode.getSiteId());
        list.add(recode.getCurrency());
        list.add(recode.getOrdersCode());
        list.add(recode.getReshipOrdersCode());
        list.add(StringUtils.isEmpty(recode.getGrandTotal()) ? "" : recode.getGrandTotal().toString());
        list.add(StringUtils.isEmpty(recode.getChargebackTime()) ? "" : DateUtil.format(recode.getChargebackTime(), "yyyy-MM-dd HH:mm:ss"));
        list.add(recode.getOrdersStatus());
        list.add(recode.getStatement());
        list.add(recode.getEbayCode());
        list.add(StringUtils.isEmpty(recode.getAmount()) ? "" : recode.getAmount().toString());
        list.add(StringUtils.isEmpty(recode.getDeff()) ? "" : recode.getDeff().toString());
        list.add(StringUtils.isEmpty(recode.getReshipType()) ? "" : ReshipType.getReshipType(recode.getReshipType()));
        list.add(StringUtils.isEmpty(recode.getOrdersDiscount()) ? "" : recode.getOrdersDiscount().toString());
        return list;
    }


}
